def binary_search(arr, item):
    low = 0
    high = len(arr) - 1
    while low <= high:
        mid = int((low + high) / 2)
        guess = arr[mid]
        if guess == item:
            return mid
        if guess > item:
            high = mid - 1
        else:
            low = mid + 1
    return None


print(binary_search([1, 3, 5, 7, 9], 3))
print(binary_search([1, 3, 5, 7, 9], 7))
print(binary_search([1, 3, 5, 7, 9], -1))


def binary_search_r(arr, item):
    if len(arr) == 0:
        return None
    low = 0
    high = len(arr) - 1
    mid = int((low + high) / 2)
    guess = arr[mid]
    if guess == item:
        return mid
    if guess > item:
        return binary_search_r(arr[low:mid], item)
    else:
        return (mid + 1) + binary_search_r(arr[(mid + 1):(high + 1)], item)


print(binary_search_r([1, 3, 5, 7, 9], 3))
print(binary_search_r([1, 3, 5, 7, 9], 7))
print(binary_search_r([1, 3, 5, 7, 9], -1))
